﻿' *
' * RM2 Character Generator
' * Copyright (C) 2009 James Culshaw
' * 
' * This program is free software; you can redistribute it and/or modify it under the terms of 
' * the GNU General Public License as published by the Free Software Foundation; either version 2 
' * of the License, or (at your option) any later version.
' * 
' * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
' * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
' * See the GNU General Public License for more details.
' * 
' * You should have received a copy of the GNU General Public License along with this program; 
' * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
' *

Imports RMCharGen.Character

Imports Microsoft.VisualStudio.TestTools.UnitTesting
Imports RMCharGen

'''<summary>
'''This is a test class for StatisticTest and is intended
'''to contain all StatisticTest Unit Tests
'''</summary>
<TestClass()> _
Public Class StatisticTest


    Private testContextInstance As TestContext

    '''<summary>
    '''Gets or sets the test context which provides
    '''information about and functionality for the current test run.
    '''</summary>
    Public Property TestContext() As TestContext
        Get
            Return testContextInstance
        End Get
        Set(ByVal value As TestContext)
            testContextInstance = Value
        End Set
    End Property

#Region "Additional test attributes"
    '
    'You can use the following additional attributes as you write your tests:
    '
    'Use ClassInitialize to run code before running the first test in the class
    '<ClassInitialize()>  _
    'Public Shared Sub MyClassInitialize(ByVal testContext As TestContext)
    'End Sub
    '
    'Use ClassCleanup to run code after all tests in a class have run
    '<ClassCleanup()>  _
    'Public Shared Sub MyClassCleanup()
    'End Sub
    '
    'Use TestInitialize to run code before running each test
    '<TestInitialize()>  _
    'Public Sub MyTestInitialize()
    'End Sub
    '
    'Use TestCleanup to run code after each test has run
    '<TestCleanup()>  _
    'Public Sub MyTestCleanup()
    'End Sub
    '
#End Region


    '''<summary>
    '''A test for Total
    '''</summary>
    <TestMethod(), _
     DeploymentItem("RMCharGen.exe")> _
    Public Sub TotalTest()
        Dim target As Statistic_Accessor = New Statistic_Accessor(StatisticType_Accessor.CO)
        Dim actual As Integer
        Dim expected As Integer = 45
        'target.Code = "CO"
        target.Actual = 100
        target.RaceBonus = 15
        target.MiscellaneousBonus = 5
        actual = target.Total
        Assert.AreEqual(expected, actual, "Total Bonus")
    End Sub

    '''<summary>
    '''A test for RaceBonus
    '''</summary>
    <TestMethod(), _
     DeploymentItem("RMCharGen.exe")> _
    Public Sub RaceBonusTest()
        Dim target As Statistic_Accessor = New Statistic_Accessor(StatisticType_Accessor.CO)
        Dim expected As Integer = 15
        Dim actual As Integer
        target.RaceBonus = expected
        actual = target.RaceBonus
        Assert.AreEqual(expected, actual)
    End Sub

    '''<summary>
    '''A test for Potential
    '''</summary>
    <TestMethod(), _
     DeploymentItem("RMCharGen.exe")> _
    Public Sub PotentialTest()
        Dim target As Statistic_Accessor = New Statistic_Accessor(StatisticType_Accessor.CO)
        Dim expected As Integer = 76
        Dim actual As Integer
        target.Potential = expected
        actual = target.Potential
        Assert.AreEqual(expected, actual)
    End Sub

    '''<summary>
    '''A test for NormalBonus
    '''</summary>
    <TestMethod(), _
     DeploymentItem("RMCharGen.exe")> _
    Public Sub NormalBonusTest()
        Dim target As Statistic_Accessor = New Statistic_Accessor(StatisticType_Accessor.CO)
        Dim expected As Integer

        target.Actual = 0
        expected = -25
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 1
        expected = -25
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 2
        expected = -20
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 3
        expected = -15
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 4
        expected = -15
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 5
        expected = -10
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 9
        expected = -10
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 10
        expected = -5
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 24
        expected = -5
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 25
        expected = 0
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 74
        expected = 0
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 75
        expected = 5
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 89
        expected = 5
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 90
        expected = 10
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 94
        expected = 10
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 95
        expected = 15
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 97
        expected = 15
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 98
        expected = 20
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 99
        expected = 20
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 100
        expected = 25
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 101
        expected = 30
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 102
        expected = 35
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

        target.Actual = 110
        expected = 35
        Assert.AreEqual(expected, target.NormalBonus, "Normal Bonus")

    End Sub

    '''<summary>
    '''A test for Name
    '''</summary>
    <TestMethod(), _
     DeploymentItem("RMCharGen.exe")> _
    Public Sub NameTest()
        Dim target As Statistic_Accessor = New Statistic_Accessor(StatisticType_Accessor.CO)
        Dim expected As String = "Constitution"
        Dim actual As String
        actual = target.Name
        Assert.AreEqual(expected, actual)
    End Sub

    '''<summary>
    '''A test for MiscellaneousBonus
    '''</summary>
    <TestMethod(), _
     DeploymentItem("RMCharGen.exe")> _
    Public Sub MiscellaneousBonusTest()
        Dim target As Statistic_Accessor = New Statistic_Accessor(StatisticType_Accessor.CO)
        Dim expected As Integer = 10
        Dim actual As Integer
        target.MiscellaneousBonus = expected
        actual = target.MiscellaneousBonus
        Assert.AreEqual(expected, actual)
    End Sub

    '''<summary>
    '''A test for Initial
    '''</summary>
    <TestMethod(), _
     DeploymentItem("RMCharGen.exe")> _
    Public Sub InitialTest()
        Dim target As Statistic_Accessor = New Statistic_Accessor(StatisticType_Accessor.CO)
        Dim expected As Integer = 89
        Dim actual As Integer
        target.Initial = expected
        actual = target.Initial
        Assert.AreEqual(expected, actual)
    End Sub

    '''<summary>
    '''A test for DevelopmentPoints
    '''</summary>
    <TestMethod(), _
     DeploymentItem("RMCharGen.exe")> _
    Public Sub DevelopmentPointsTest()
        Dim expected As Integer
        Dim target As Statistic_Accessor = New Statistic_Accessor(StatisticType_Accessor.CO)

        target.Actual = 0
        expected = 1
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 1
        expected = 1
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 4
        expected = 1
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 5
        expected = 2
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 14
        expected = 2
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 15
        expected = 3
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 24
        expected = 3
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 25
        expected = 4
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 39
        expected = 4
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 40
        expected = 5
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 59
        expected = 5
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 60
        expected = 6
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 74
        expected = 6
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 75
        expected = 7
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 84
        expected = 7
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 85
        expected = 8
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 94
        expected = 8
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 95
        expected = 9
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 99
        expected = 9
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 100
        expected = 10
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 101
        expected = 10
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 102
        expected = 11
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 110
        expected = 11
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

    End Sub

    '''<summary>
    '''A test for DevelopmentPoints
    '''</summary>
    <TestMethod(), _
     DeploymentItem("RMCharGen.exe")> _
    Public Sub DevelopmentPointsTest2()
        Dim expected As Integer = 0
        Dim target As Statistic_Accessor = New Statistic_Accessor(StatisticType_Accessor.St)

        target.Actual = 0
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 1
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 4
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 5
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 14
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 15
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 24
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 25
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 39
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 40
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 59
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 60
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 74
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 75
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 84
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 85
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 94
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 95
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 99
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 100
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 101
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 102
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

        target.Actual = 110
        Assert.AreEqual(expected, target.DevelopmentPoints, "Development Points")

    End Sub

    '''<summary>
    '''A test for Code
    '''</summary>
    <TestMethod(), _
     DeploymentItem("RMCharGen.exe")> _
    Public Sub CodeTest()
        Dim target As Statistic_Accessor = New Statistic_Accessor(StatisticType_Accessor.AG)
        Dim expected As String = "AG"
        Dim actual As String
        actual = target.Code
        Assert.AreEqual(expected, actual)
    End Sub

    '''<summary>
    '''A test for Actual
    '''</summary>
    <TestMethod(), _
     DeploymentItem("RMCharGen.exe")> _
    Public Sub ActualTest()
        Dim target As Statistic_Accessor = New Statistic_Accessor(StatisticType_Accessor.CO)
        Dim expected As Integer = 78
        Dim actual As Integer
        target.Actual = expected
        actual = target.Actual
        Assert.AreEqual(expected, actual)
    End Sub

    '''<summary>
    '''A test for Statistic Constructor
    '''</summary>
    <TestMethod(), _
     DeploymentItem("RMCharGen.exe")> _
    Public Sub StatisticConstructorTest()

        Dim target As Statistic_Accessor = New Statistic_Accessor(StatisticType_Accessor.CO)
        Assert.AreEqual("CO", target.Code, "Code")
        Assert.AreEqual("Constitution", target.Name, "Name")
        Assert.AreEqual(0, target.Initial, "Initial")
        Assert.AreEqual(0, target.Potential, "Potential")
        Assert.AreEqual(0, target.Actual, "Actual")
        Assert.AreEqual(1, target.DevelopmentPoints, "Development Points")
        Assert.AreEqual(-25, target.NormalBonus, "Normal Bonus")
        Assert.AreEqual(0, target.RaceBonus, "Race Bonus")
        Assert.AreEqual(0, target.MiscellaneousBonus, "Miscellanepus Bonus")
        Assert.AreEqual(-25, target.Total, "Total")

        target = New Statistic_Accessor(StatisticType_Accessor.AG)
        Assert.AreEqual("AG", target.Code, "Code")
        Assert.AreEqual("Agility", target.Name, "Name")
        Assert.AreEqual(0, target.Initial, "Initial")
        Assert.AreEqual(0, target.Potential, "Potential")
        Assert.AreEqual(0, target.Actual, "Actual")
        Assert.AreEqual(1, target.DevelopmentPoints, "Development Points")
        Assert.AreEqual(-25, target.NormalBonus, "Normal Bonus")
        Assert.AreEqual(0, target.RaceBonus, "Race Bonus")
        Assert.AreEqual(0, target.MiscellaneousBonus, "Miscellanepus Bonus")
        Assert.AreEqual(-25, target.Total, "Total")

        target = New Statistic_Accessor(StatisticType_Accessor.SD)
        Assert.AreEqual("SD", target.Code, "Code")
        Assert.AreEqual("Self Discipline", target.Name, "Name")
        Assert.AreEqual(0, target.Initial, "Initial")
        Assert.AreEqual(0, target.Potential, "Potential")
        Assert.AreEqual(0, target.Actual, "Actual")
        Assert.AreEqual(1, target.DevelopmentPoints, "Development Points")
        Assert.AreEqual(-25, target.NormalBonus, "Normal Bonus")
        Assert.AreEqual(0, target.RaceBonus, "Race Bonus")
        Assert.AreEqual(0, target.MiscellaneousBonus, "Miscellanepus Bonus")
        Assert.AreEqual(-25, target.Total, "Total")

        target = New Statistic_Accessor(StatisticType_Accessor.Me)
        Assert.AreEqual("Me", target.Code, "Code")
        Assert.AreEqual("Memory", target.Name, "Name")
        Assert.AreEqual(0, target.Initial, "Initial")
        Assert.AreEqual(0, target.Potential, "Potential")
        Assert.AreEqual(0, target.Actual, "Actual")
        Assert.AreEqual(1, target.DevelopmentPoints, "Development Points")
        Assert.AreEqual(-25, target.NormalBonus, "Normal Bonus")
        Assert.AreEqual(0, target.RaceBonus, "Race Bonus")
        Assert.AreEqual(0, target.MiscellaneousBonus, "Miscellanepus Bonus")
        Assert.AreEqual(-25, target.Total, "Total")

        target = New Statistic_Accessor(StatisticType_Accessor.Re)
        Assert.AreEqual("Re", target.Code, "Code")
        Assert.AreEqual("Reasoning", target.Name, "Name")
        Assert.AreEqual(0, target.Initial, "Initial")
        Assert.AreEqual(0, target.Potential, "Potential")
        Assert.AreEqual(0, target.Actual, "Actual")
        Assert.AreEqual(1, target.DevelopmentPoints, "Development Points")
        Assert.AreEqual(-25, target.NormalBonus, "Normal Bonus")
        Assert.AreEqual(0, target.RaceBonus, "Race Bonus")
        Assert.AreEqual(0, target.MiscellaneousBonus, "Miscellanepus Bonus")
        Assert.AreEqual(-25, target.Total, "Total")

        target = New Statistic_Accessor(StatisticType_Accessor.St)
        Assert.AreEqual("St", target.Code, "Code")
        Assert.AreEqual("Strength", target.Name, "Name")
        Assert.AreEqual(0, target.Initial, "Initial")
        Assert.AreEqual(0, target.Potential, "Potential")
        Assert.AreEqual(0, target.Actual, "Actual")
        Assert.AreEqual(0, target.DevelopmentPoints, "Development Points")
        Assert.AreEqual(-25, target.NormalBonus, "Normal Bonus")
        Assert.AreEqual(0, target.RaceBonus, "Race Bonus")
        Assert.AreEqual(0, target.MiscellaneousBonus, "Miscellanepus Bonus")
        Assert.AreEqual(-25, target.Total, "Total")

        target = New Statistic_Accessor(StatisticType_Accessor.Qu)
        Assert.AreEqual("Qu", target.Code, "Code")
        Assert.AreEqual("Quickness", target.Name, "Name")
        Assert.AreEqual(0, target.Initial, "Initial")
        Assert.AreEqual(0, target.Potential, "Potential")
        Assert.AreEqual(0, target.Actual, "Actual")
        Assert.AreEqual(0, target.DevelopmentPoints, "Development Points")
        Assert.AreEqual(-25, target.NormalBonus, "Normal Bonus")
        Assert.AreEqual(0, target.RaceBonus, "Race Bonus")
        Assert.AreEqual(0, target.MiscellaneousBonus, "Miscellanepus Bonus")
        Assert.AreEqual(-25, target.Total, "Total")

        target = New Statistic_Accessor(StatisticType_Accessor.Pr)
        Assert.AreEqual("Pr", target.Code, "Code")
        Assert.AreEqual("Presence", target.Name, "Name")
        Assert.AreEqual(0, target.Initial, "Initial")
        Assert.AreEqual(0, target.Potential, "Potential")
        Assert.AreEqual(0, target.Actual, "Actual")
        Assert.AreEqual(0, target.DevelopmentPoints, "Development Points")
        Assert.AreEqual(-25, target.NormalBonus, "Normal Bonus")
        Assert.AreEqual(0, target.RaceBonus, "Race Bonus")
        Assert.AreEqual(0, target.MiscellaneousBonus, "Miscellanepus Bonus")
        Assert.AreEqual(-25, target.Total, "Total")

        target = New Statistic_Accessor(StatisticType_Accessor.In)
        Assert.AreEqual("In", target.Code, "Code")
        Assert.AreEqual("Intuition", target.Name, "Name")
        Assert.AreEqual(0, target.Initial, "Initial")
        Assert.AreEqual(0, target.Potential, "Potential")
        Assert.AreEqual(0, target.Actual, "Actual")
        Assert.AreEqual(0, target.DevelopmentPoints, "Development Points")
        Assert.AreEqual(-25, target.NormalBonus, "Normal Bonus")
        Assert.AreEqual(0, target.RaceBonus, "Race Bonus")
        Assert.AreEqual(0, target.MiscellaneousBonus, "Miscellanepus Bonus")
        Assert.AreEqual(-25, target.Total, "Total")

        target = New Statistic_Accessor(StatisticType_Accessor.EM)
        Assert.AreEqual("EM", target.Code, "Code")
        Assert.AreEqual("Empathy", target.Name, "Name")
        Assert.AreEqual(0, target.Initial, "Initial")
        Assert.AreEqual(0, target.Potential, "Potential")
        Assert.AreEqual(0, target.Actual, "Actual")
        Assert.AreEqual(0, target.DevelopmentPoints, "Development Points")
        Assert.AreEqual(-25, target.NormalBonus, "Normal Bonus")
        Assert.AreEqual(0, target.RaceBonus, "Race Bonus")
        Assert.AreEqual(0, target.MiscellaneousBonus, "Miscellanepus Bonus")
        Assert.AreEqual(-25, target.Total, "Total")

    End Sub


End Class
